<!-- 新闻 详情 -->
<template>
	<view class="container">
		<view>
			<my-list ref="myList"
				:api="productList" :params="params" :transformRequestData="transformRequestData">>
				<template v-slot:card="{list}">
					<view class="product-list-wrapper">
						<view style="background-color: #fff;margin: 30rpx 30rpx;padding: 30rpx;" v-for="(item,index) in list"> 
							<view>
								<text>- {{ item.createtime }}</text>
							</view>
							<view style="margin: 20rpx 0;">
								【{{ item.title }}】：
							</view>
							<liu-show-hide showText="继续阅读" hideText="收起" >
								<view class="content">
									<rich-text :nodes="item.content"></rich-text>
								</view>
								
							</liu-show-hide>
						</view>
					</view>
				</template>
			</my-list>
		</view>
		
	</view>
</template>

<script>
	import request from '@/common/request.js';
	export default {
		data() {
			return {
				newsData: [],
				requestStatus: false // 事件防抖
			}
		},
		onLoad(option) {
			console.log(option)
		},
		computed:{
			params() {
				return {
					
					limit:10
				};
			}
		},
		onPullDownRefresh() {
			this.$refs.myList.onRefresh();
		},
		onReachBottom() {
			this.$refs.myList.onMore();
		},
		methods: {
			
			transformRequestData(data) {
					console.log('data111', data.data.data)
					return data.data.data.data;
			},
			productList(value) {
				console.log('111',value)
				let opts = {
					url: 'api/notices/list',
					method: 'get'
				};
				const result = request.httpRequest(opts,value)

				// const result =  request.httpTokenRequest(opts, value);
				return result;
			
			},
		},
		filters: {
			formatDate(value) {
				if (value == undefined) {
					return;
				}
				// let date = new Date(value * 1000);
				let date = new Date(value);
				//时间戳为10位需*1000，时间戳为13位的话不需乘1000
				let y = date.getFullYear();
				let MM = date.getMonth() + 1;
				MM = MM < 10 ? ('0' + MM) : MM; //月补0
				let d = date.getDate();
				d = d < 10 ? ('0' + d) : d; //天补0
				let h = date.getHours();
				h = h < 10 ? ('0' + h) : h; //小时补0
				let m = date.getMinutes();
				m = m < 10 ? ('0' + m) : m; //分钟补0
				let s = date.getSeconds();
				s = s < 10 ? ('0' + s) : s; //秒补0
				// return y + '-' + MM + '-' + d; //年月日
				return y + '-' + MM + '-' + d + ' ' + h + ':' + m; //年月日时分秒
			},
		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #f2f2f2;
	}
</style>
